﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Fluent;
using Fluent.HtmlModel;

namespace Fluent.HtmlModel
{
    public class PanelLoader<TPage, TPanel> : HtmlControl<TPage>
        where TPage : WebPageBase
        where TPanel : IPagePartial
    {
        private TPanel _panel { get; set; }

        public PanelLoader(TPage page, Finder finder, TPanel panel)
            : base(page, finder)
        {
            this._panel = panel;
        }

        public TPanel Load()
        {
            base.Click();
            return this._panel;
        }

        public TPage Load(Action<TPanel> actionsInPanel)
        {
            this.Load();
            actionsInPanel(this._panel);
            return this.Page;
        }
    }
}
